# $Id: PKGBUILD 184239 2013-05-04 19:38:00Z foutrelis $
# Maintainer: Eric Belanger <eric@archlinux.org>
# Contributor: Kritoke <typeolinux@yahoo.com>

pkgname=gnumeric
pkgver=1.12.2
pkgrel=1
pkgdesc="A GNOME Spreadsheet Program"
arch=('i686' 'x86_64')
url="http://www.gnome.org/projects/gnumeric/"
license=('GPL')
depends=('goffice' 'desktop-file-utils' 'hicolor-icon-theme')
makedepends=('intltool' 'psiconv' 'pygobject-devel' 'gnome-doc-utils'
             'gobject-introspection' 'optipng')
optdepends=('python2-gobject: for python plugin support'
            'perl: for perl plugin support'
            'psiconv: for Psion 5 file support'
            'yelp: for viewing the help manual')
install=gnumeric.install
options=('!libtool')
source=(http://ftp.gnome.org/pub/gnome/sources/${pkgname}/${pkgver%.*}/${pkgname}-${pkgver}.tar.xz
        gnumeric-1.12.1-automake-1.13.patch
        revert-warnings.patch)
sha256sums=('d6fda191c1c76be2ede21fe78b8c9f96d39aea82ccfb537775a83bf88d781874'
            '1eb57b931023d961e9d0f3675fe96b5559270fa38c97401cb06fc7aed9c8e275'
            'bcafca016b809000c2a5bf911e2e3dfa4de28f9e541d9964574cac5c7ce09e53')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  patch -Np1 -i ../gnumeric-1.12.1-automake-1.13.patch
  patch -Np0 -i ../revert-warnings.patch

  # Remove invalid mime type. (FS#26338)
  sed -i -e 's/zz-application\/zz-winassoc-xls;//' gnumeric.desktop.in

  autoreconf -fi

  # Fix invalid PNG images to work with libpng 1.6
  # https://bugzilla.gnome.org/show_bug.cgi?id=699683
  find -name '*.png' -exec optipng -quiet -force -fix {} +
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
    --disable-schemas-compile --enable-introspection
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}
